const { app, BrowserWindow } = require('electron');
const path = require('path');

function createWindow(params) {}

// 创建浏览器窗口
function createWindow() {
  const win = new BrowserWindow({
    width: 800,
    height: 1500,
    webPreferences: {
      preload: path.join(__dirname, 'preload.js')
    }
  });
  win.loadURL('https://baidu.com');

  const contents = win.webContents;
  console.log(contents);

  // 打开开发者工具
  win.webContents.openDevTools();
}

app.whenReady().then(createWindow);

// 当 macOS 无窗口打开时退出应用，macOS除外
app.on('window-all-closed', function () {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});
